package homework.job4

import akka.actor.{Actor, ActorRef}

class AActor(bActorRef: ActorRef) extends Actor{
  private var count =0

  override def receive: Receive = {
    case "start" => {
      println("AActor 出招了")
      self ! "1"
    }
    case "1"=>{
      count+=1
        //给BActor发出消息 需要持有B的引用Ref
      println(s"AActor 出招 $count")
      Thread.sleep(2000)
      bActorRef ! "1" //给Bactor发送消息
    }

  }
}
